<script language="javascript">
    $(document).ready(function(){
        $("#checkall").click(function(){
            var checked_status = this.checked;
            $('input[type="checkbox"]').each(function(){
               this.checked = checked_status;
            });
        });
    });
</script>

<script language="javascript">
    $(document).ready(function(){
        $("#checkall").click(function(){
            var checked_status = this.checked;
            $('input[type="checkbox"]').each(function(){
               this.checked = checked_status;
            });
        });
    });
</script>
<?php //echo $javascript->link('jquery-1.4.2.js');?>
<?php echo $this->Form->create('ThanhToan',array('action'=>'admin_process')); ?>
<div class="head_title"><h1 ALIGN="CENTER">BẢNG PHIẾU THANH TOÁN</h1></div>

<table>
    <tr>
		<th><?php echo $this->Form->checkbox('all',array('id'=>'checkall')); ?></th>
        <th>ID</th>
        <th>MÃ KHÁCH HÀNG</th>
        <th>MÃ NHÂN VIÊN</th>
        <th>SỐ TIỀN THANH TOÁN</th>
        <th>NGÀY THANH TOÁN</th>
        <th>THAY ĐỔI</th>
    </tr>

    <?php foreach ($thanhtoans as $thanhtoan): ?>
    <tr>
	<td><?php echo $this->Form->checkbox('ThanhToan.id.'.$thanhtoan['ThanhToan']['id']); ?></td>
        <td>
            <?php echo $thanhtoan['ThanhToan']['id'];?>
        </td>
        <td>
            <?php echo $thanhtoan['ThanhToan']['MAKH'];?>
        </td>
        <td>
            <?php echo $thanhtoan['ThanhToan']['MANV'];?>
        </td>
        <td>
            <?php echo $thanhtoan['ThanhToan']['SOTIENTHANHTOAN'];?>
        </td>
        <td>
            <?php echo date('d-m-Y', strtotime($thanhtoan['ThanhToan']['NGAYTHANHTOAN']));?>
        </td>
        <td>
            <?php
            if ($this->Session->read('quyen') != 'nhanvien') {
                echo $this->Html->link($this->Html->image('/images/user_edit.png'), array('action' => 'edit', $thanhtoan['ThanhToan']['id']), array('escape' => false));
            } else echo '&nbsp';
            ?>
            <?php if ($this->Session->read('quyen') == 'quantri') {
            echo $this->Html->link($this->Html->image('/images/trash.png'), array('action' => 'delete', $thanhtoan['ThanhToan']['id']),
                array('confirm' => 'Bạn có chắc muốn xóa?', 'escape' => false));
        }?>
        </td>
    </tr>
    <?php endforeach; ?>

</table>

<?php
     echo $this->Form->end('Xóa các mục đã chọn', array('action' => 'Delete'));
?>

<div id="pagination">
    <div class="paging">
        <?php echo $this->Paginator->first('Trang đầu'); ?>
        <?php echo $this->Paginator->prev('<<' . __('Lùi', true),
        array(), null, array('class' => 'disabled')); ?>
        <?php echo $this->Paginator->numbers(); ?>
        <?php echo $this->Paginator->next(__('Tới', true) . '>>',
        array(), null, array('class' => 'disabled')); ?>
        <?php echo $this->Paginator->last('Trang cuối'); ?>
    </div>
</div>
<p><?php echo $this->Html->link('Thêm phiếu thanh toán', array('action' => 'add'), array('class' => 'add')); ?></p>